// let $ = require("jquery");
module.exports = {
    /***
     * 将任意数量对象或者字符串传入该方法，若有任意一个为空，则返回true
     * 可判断 空对象 空数组 空字符串 undefined null
     * @returns {boolean}
     */
    isEmpty: function (){
        let len = arguments.length;
        if(len === 0){ return true; }
        for(let i=0;i<len;i++){
            let a = arguments[i];
            if(typeof a === "undefined" || a === null || (typeof a === "string" && a.trim() === "")){
                return true;
            }else if(typeof a === "object"){
                let flg = true;
                for (let name in a ) {
                    flg = false;
                    break;
                }
                if(flg){ return true; }
            }
        }
        return false;
    },
    uuid:function (len, radix) {
        let CHARS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
        let chars = CHARS, uuid = [], i;
        radix = radix || chars.length;
        if (len) {
            for (i = 0; i < len; i++) uuid[i] = chars[0 | Math.random()*radix];
        } else {
            let r;
            uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-';
            uuid[14] = '4';
            for (i = 0; i < 36; i++) {
                if (!uuid[i]) {
                    r = 0 | Math.random()*16;
                    uuid[i] = chars[(i === 19) ? (r & 0x3) | 0x8 : r];
                }
            }
        }
        return uuid.join('');
    },
    timeFormat:function (date, fmt) {
        let o = {
            "M+": date.getMonth() + 1, //月份
            "d+": date.getDate(), //日
            "h+": date.getHours(), //小时
            "m+": date.getMinutes(), //分
            "s+": date.getSeconds(), //秒
            "q+": Math.floor((date.getMonth() + 3) / 3), //季度
            "S": date.getMilliseconds() //毫秒
        };
        if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
        for (let k in o)
            if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
        return fmt;
    }/*,
    ajax:function (para) {
        let finalOption = Object.assign({
            type:"get",
            dataType:"json"
        },para);
        return $.ajax(finalOption)
    }*/
};